Skip to content

Conversation

@kitten
Copy link
Contributor

@kitten kitten commented Nov 19, 2025

Summary:

The argument for the output path to this CLI has always been optional, but the types didn't reflect this, which caused a few regressions in recent changes (e.g. #53503)

We should default to the projectRoot as implied by computeOutputPath.

Resolves #54473

Changelog:

[GENERAL] [FIXED] - Ensure codegen CLI supports unspecified --outputPath argument

Test Plan:

  • Manually run react-native codegen in rn-tester

…optional

The argument for the output path was always optional. This wasn't
reflected in types, however, so this was missed in two prior changes.
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 19, 2025
@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 19, 2025
@kitten kitten force-pushed the @kitten/fix/optional-base-output-path branch from b64d3f9 to 397b02c Compare November 19, 2025 17:30
@meta-codesync
Copy link

meta-codesync bot commented Nov 19, 2025

@cortinico has imported this pull request. If you are a Meta employee, you can view this in D87456501.

Copy link
Contributor

@cipolleschi cipolleschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix. I left a few suggestions and a couple of questions.

const relativeAppPath =
outputPath != null && outputPath.length > 0
? path.relative(outputPath, appPath)
: '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if outputPath is not passed, the relativeAppPath is '.'?
Are we sure it is correct?

Comment on lines +87 to +90
const relativeReactNativeRootFolder =
outputPath != null && outputPath.length > 0
? path.relative(outputPath, REACT_NATIVE_PACKAGE_ROOT_FOLDER)
: '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if outputPath is not passed, the relativeAppPath is '.'?
Are we sure it is correct?

if (platform === 'android') {
return defaultOutputPathForAndroid(baseOutputPath);
return defaultOutputPathForAndroid(
baseOutputPath != null && baseOutputPath.length > 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

baseOutputPath can't be null anymore here, right?

if (platform === 'ios') {
return defaultOutputPathForIOS(baseOutputPath);
return defaultOutputPathForIOS(
baseOutputPath != null && baseOutputPath.length > 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

baseOutputPath can't be null anymore here, right?

Co-authored-by: Riccardo Cipolleschi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Codegen CLI can not be run without the --outputPath parameter specified since 0.81.2.

3 participants